#include "Couleur.hpp"

#include "Bruit/Bruit.hpp"

#include "Image/ImageFilePPM.hpp"

#include "Materiaux/Melange.hpp"

using namespace std;
using namespace Perlin;

int main( int argc, char *argv[] )
{
  string nom( "test.ppm" );

  double valeur;

  Couleur c1( 255, 0, 0 ), c2( 0, 255, 0), c3( 0, 0, 255), col;

  Bruit mel( 400, 8., 4, Cubique );

  ImageFilePPM test( 500, 250, nom );

  for (int i(0), j; i < 500; i++)
    {
      /*
	j = static_cast< int >( 250. * mel( i ) );
	test.pixel( j, i, c1);
	j = static_cast< int >( 125. * mel( i * 2 ) + 62. );
	test.pixel( j, i, c2 );
	j = static_cast< int >( 62.5 * mel( i * 4 ) + 90. );
	test.pixel( j, i, c3 );
      */
      for (j = 0; j < 250; j++)
	{
	  valeur = mel( i, j );
	  col = c1;
	  col.attenue( valeur );
	  test.setPixel( j, i, col );
	}
    }

  /*
    col = Couleur( 0, 0, 0 );
    
    mel.octaves( 3 );
    for (int i(0), j; i < 500; i++)
    {
    j = static_cast< int >( 250. * mel( i ) );
    test.pixel( j, i, col);
    }
  */

  test.affiche();

  return 0;
}
